##Service层模板

import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import java.util.List;
import com.zuoyy.common.enums.StatusEnum;
import com.zuoyy.common.utils.EntityBeanUtil;
import com.zuoyy.common.vo.JsonResponse;
import com.zuoyy.admin.xbzq.service.BaseInterface;


/**
 * @author zuo
 */
@Service
public class #{entity}InterfaceImpl extends BaseInterface implements #{entity}Interface {

    @Autowired
    private #{entity}Service #{name}Service;


    @Override
    public JsonResponse getListPage(#{entity}Query query) {
        Page<#{entity}> page = #{name}Service.getPageList(query);
        List<#{entity}> list = page.getContent();
        return JsonResponse.success(setQueryResult(query.getDraw(), (int) page.getTotalElements(),list));
    }

    @Override
    public JsonResponse saveOrUpdate(#{entity} domain) {
        if (!StringUtils.isEmpty(domain.getId())) {
            #{entity} #{name} = #{name}Service.findById(domain.getId());
            EntityBeanUtil.copyProperties(#{name}, domain);
        }
        #{name}Service.save(domain);
        return JsonResponse.success();
    }


    @Override
    @Transactional
    public JsonResponse updateStatus(StatusEnum statusEnum, List<String> ids) {
        if (#{name}Service.updateStatus(statusEnum, ids)) {
            return JsonResponse.success(statusEnum.message + "成功");
        } else {
            return JsonResponse.error(statusEnum.message + "失败，请重新操作");
        }
    }





}